package com.rainbow.bam.application;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.context.web.SpringBootServletInitializer;
import org.springframework.boot.orm.jpa.EntityScan;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;

import com.rainbow.bam.base.BaseRepositoryFactoryBean;

/**
 * 应用启动类
 * 
 * @author HarrisonHan
 * @version $Id: ApplicationBuilder.java, v 0.1 2015年10月23日 下午4:13:07 HarrisonHan Exp $
 */
@Configuration
@ComponentScan(basePackages = "com.rainbow.bam")
@EntityScan("com.rainbow.bam.entity")
@EnableJpaRepositories(basePackages = "com.rainbow.bam.dao",repositoryFactoryBeanClass = BaseRepositoryFactoryBean.class)
@EnableAutoConfiguration
public class ApplicationBuilder extends  SpringBootServletInitializer{
    
    protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
        return application.sources(ApplicationBuilder.class);
    }
    
    public static void main(String[] args) {
        SpringApplication.run(ApplicationBuilder.class, args);
    }
}
